<!doctype html><html lang=en-us dir=ltr><head><meta charset=UTF-8><meta name=viewport content="width=device-width,initial-scale=1"><meta name=description content="前传: [[Make things easy and enjoyable]]
1. 递归删除某些文件 # 如以.py.bak 为结尾的文件: find . -name &#34;*.py.bak&#34; -exec rm {} \;
2. 批量杀死进程 # - pkill -f uwsgi
- ps aux | grep 关键字 | awk &lsquo;{print $2}&rsquo; | xargs kill
批量删除pod - xargs 的使用 # kubectl get pod -n argo | grep workflow-template | awk '{print $1}' | xargs kubectl -n argo delete pod 3. MySQL NOW # 指定东八：update scanner_device set update_time = CONVERT_TZ(NOW(), @@session."><meta name=theme-color content="#FFFFFF"><meta name=color-scheme content="light dark"><meta property="og:title" content="小命令"><meta property="og:description" content="前传: [[Make things easy and enjoyable]]
1. 递归删除某些文件 # 如以.py.bak 为结尾的文件: find . -name &#34;*.py.bak&#34; -exec rm {} \;
2. 批量杀死进程 # - pkill -f uwsgi
- ps aux | grep 关键字 | awk &lsquo;{print $2}&rsquo; | xargs kill
批量删除pod - xargs 的使用 # kubectl get pod -n argo | grep workflow-template | awk '{print $1}' | xargs kubectl -n argo delete pod 3. MySQL NOW # 指定东八：update scanner_device set update_time = CONVERT_TZ(NOW(), @@session."><meta property="og:type" content="article"><meta property="og:url" content="http://example.org/posts/%E5%B0%8F%E5%91%BD%E4%BB%A4/"><meta property="article:section" content="posts"><meta property="article:published_time" content="2023-09-24T23:03:41+00:00"><meta property="article:modified_time" content="2023-09-24T23:03:41+00:00"><title>小命令 | Ian's Blog</title>
<link rel=manifest href=/manifest.json><link rel=icon href=/favicon.png type=image/x-icon><link rel=stylesheet href=/book.min.c58292d36b18b675680ab9baea2029204537b839ea72f258746ec0f32ce8d6c8.css integrity="sha256-xYKS02sYtnVoCrm66iApIEU3uDnqcvJYdG7A8yzo1sg=" crossorigin=anonymous><script defer src=/flexsearch.min.js></script><script defer src=/en.search.min.80b0c12c6a3982c23bab5eb1d10c75b4cf8bfbaa1c7e183729648ce8a09207d7.js integrity="sha256-gLDBLGo5gsI7q16x0Qx1tM+L+6ocfhg3KWSM6KCSB9c=" crossorigin=anonymous></script></head><body dir=ltr><input type=checkbox class="hidden toggle" id=menu-control>
<input type=checkbox class="hidden toggle" id=toc-control><main class="container flex"><aside class=book-menu><div class=book-menu-content><nav><h2 class=book-brand><a class="flex align-center" href=/><span>Ian's Blog</span></a></h2><div class=book-search><input type=text id=book-search-input placeholder=Search aria-label=Search maxlength=64 data-hotkeys=s/><div class="book-search-spinner hidden"></div><ul id=book-search-results></ul></div><ul><li class=book-section-flat><a href=/docs/programmer/>程序员笔记</a><ul><li><input type=checkbox id=section-d5f99046a51e5e750b61f2e037945fcc class=toggle>
<label for=section-d5f99046a51e5e750b61f2e037945fcc class="flex justify-between"><a role=button>基础工具和配置</a></label><ul><li><a href=/docs/programmer/basetc/%E6%96%87%E6%9C%AC%E4%B8%89%E5%89%91%E5%AE%A2/>文本三剑客</a></li><li><a href=/docs/programmer/basetc/tmux/>Tmux使用笔记</a></li><li><a href=/docs/programmer/basetc/obsidian%E6%80%9D%E7%BB%B4%E5%AF%BC%E5%9B%BE%E6%8F%92%E4%BB%B6/>Obsidian思维导图插件</a></li><li><a href=/docs/programmer/basetc/for_china/>各个软件换源</a></li><li><a href=/docs/programmer/basetc/tipsofvim/>tip Of vim</a></li><li><a href=/docs/programmer/basetc/editer/>编辑器使用</a></li><li><a href=/docs/programmer/basetc/bash/>Bash</a></li><li><a href=/docs/programmer/basetc/gitbook/>Gitbook</a></li><li><a href=/docs/programmer/basetc/vim/>Vim</a></li><li><a href=/docs/programmer/basetc/%E5%AE%88%E6%8A%A4%E8%BF%9B%E7%A8%8B/>supervisor</a></li></ul></li><li><input type=checkbox id=section-8658298e10b544e890095f646916165a class=toggle>
<label for=section-8658298e10b544e890095f646916165a class="flex justify-between"><a href=/docs/programmer/cloudnative/>云原生</a></label><ul><li><input type=checkbox id=section-31d3b02fd4a132635e483e7e756058ea class=toggle>
<label for=section-31d3b02fd4a132635e483e7e756058ea class="flex justify-between"><a href=/docs/programmer/cloudnative/redis/>中间件</a></label><ul><li><a href=/docs/programmer/cloudnative/redis/python-redis-%E5%AE%A2%E6%88%B7%E7%AB%AF/>Python Redis 客户端</a></li><li><a href=/docs/programmer/cloudnative/redis/bigkey-and-hotkey/>大key、热key问题</a></li><li><a href=/docs/programmer/cloudnative/redis/the-basics-of-redis/>Redis基础</a></li><li><a href=/docs/programmer/cloudnative/redis/advanced-knowledge-of-redis/>Redis进阶</a></li><li><a href=/docs/programmer/cloudnative/redis/%E4%BD%BF%E7%94%A8%E5%91%BD%E4%BB%A4/>Redis常用命令</a></li></ul></li><li><input type=checkbox id=section-62d608ed890b3abc76dae78ccfcab912 class=toggle>
<label for=section-62d608ed890b3abc76dae78ccfcab912 class="flex justify-between"><a role=button>k8s</a></label><ul><li><a href=/docs/programmer/cloudnative/k8s/elk%E5%9C%A8k8s%E4%B8%8A%E7%9A%84%E9%83%A8%E7%BD%B2%E4%BD%BF%E7%94%A8%E7%A4%BA%E4%BE%8B/>elk在k8s上的部署使用示例</a></li><li><a href=/docs/programmer/cloudnative/k8s/k8s-%E9%85%8D%E5%A5%97%E8%AF%B4%E6%98%8E/>k8s 配套说明</a></li><li><a href=/docs/programmer/cloudnative/k8s/k8s-%E6%8A%80%E6%9C%AF%E5%88%86%E4%BA%AB/>k8s技术分享</a></li><li><a href=/docs/programmer/cloudnative/k8s/k8s%E5%B8%B8%E7%94%A8%E5%91%BD%E4%BB%A4%E5%92%8C%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6%E8%A7%A3%E6%9E%90/>k8s学习-常用命令和配置文件</a></li><li><a href=/docs/programmer/cloudnative/k8s/argo-workflow%E6%80%A7%E8%83%BD%E6%B5%8B%E8%AF%95%E5%92%8C%E4%BD%BF%E7%94%A8%E5%9C%BA%E6%99%AF%E5%88%86%E6%9E%90/>Argo Workflow性能测试和使用场景分析</a></li><li><a href=/docs/programmer/cloudnative/k8s/argo-%E4%BD%BF%E7%94%A8%E8%AE%B0%E5%BD%95/>Argo 使用记录</a></li></ul></li><li><input type=checkbox id=section-b828bf3d116bc282da9db25a06bf908e class=toggle>
<label for=section-b828bf3d116bc282da9db25a06bf908e class="flex justify-between"><a role=button>中间件</a></label><ul><li><a href=/docs/programmer/cloudnative/middleware/kafka-%E5%AE%89%E8%A3%85%E5%92%8C%E4%BD%BF%E7%94%A8/>Kafka 安装和使用</a></li></ul></li><li><a href=/docs/programmer/cloudnative/%E5%AE%B9%E5%99%A8/note-of-podman/>Podman</a></li><li><a href=/docs/programmer/cloudnative/nginx%E5%AE%9E%E7%94%A8%E9%85%8D%E7%BD%AE/>Nginx实用配置</a></li><li><a href=/docs/programmer/cloudnative/uwsgi-%E5%A4%84%E7%90%86%E8%AE%B0%E5%BD%95/>uwsgi 处理记录</a></li><li><a href=/docs/programmer/cloudnative/note-of-docker/>Docker</a></li><li><a href=/docs/programmer/cloudnative/%E5%AE%B9%E5%99%A8/note-of-docker/>Docker</a></li><li><a href=/docs/programmer/cloudnative/fastapi/>Django的建站的(｡･･)ﾉﾞ</a></li><li><a href=/docs/programmer/cloudnative/nginx-%E9%AB%98%E5%8F%AF%E7%94%A8/>Nginx高可用</a></li><li><a href=/docs/programmer/cloudnative/notesdjango/>Django的建站的(｡･･)ﾉﾞ</a></li><li><a href=/docs/programmer/cloudnative/sonar-%E4%BB%A3%E7%A0%81%E9%9D%99%E6%80%81%E6%A3%80%E6%9F%A5/>Sonar 代码静态检查</a></li></ul></li><li><input type=checkbox id=section-883e27361d38e16afb68faff3435ac0b class=toggle>
<label for=section-883e27361d38e16afb68faff3435ac0b class="flex justify-between"><a role=button>机器学习</a></label><ul><li><a href=/docs/programmer/ml/stable-diffusion/>AI画图</a></li><li><a href=/docs/programmer/ml/%E7%88%AC%E8%99%AB/>爬虫</a></li><li><a href=/docs/programmer/ml/paddle/>Paddle</a></li><li><a href=/docs/programmer/ml/tensorflow/>Tensorflow</a></li><li><a href=/docs/programmer/ml/opencv/>OpenCV</a></li><li><a href=/docs/programmer/ml/yolo/>Demo Test项目中的一些东西</a></li><li><a href=/docs/programmer/ml/%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E5%B8%B8%E7%94%A8%E5%BA%93%E5%9F%BA%E6%9C%AC%E7%94%A8%E6%B3%95/>机器学习库</a></li></ul></li><li><input type=checkbox id=section-0bf4f4329214e20fa67ca3e12c6aad0c class=toggle>
<label for=section-0bf4f4329214e20fa67ca3e12c6aad0c class="flex justify-between"><a role=button>平台</a></label><ul><li><a href=/docs/programmer/platforms/ubuntu/>Ubuntu</a></li><li><a href=/docs/programmer/platforms/%E9%98%BF%E9%87%8C%E4%BA%91%E4%BD%BF%E7%94%A8/>阿里云使用</a></li><li><a href=/docs/programmer/platforms/wps-for-linux/>WPS for Linux</a></li><li><a href=/docs/programmer/platforms/appsflyer/>AppsFlyer-外网移动归因营销分析平台</a></li></ul></li><li><input type=checkbox id=section-bf4e0d6f0b81f7b3ec08ed1fc66b874d class=toggle>
<label for=section-bf4e0d6f0b81f7b3ec08ed1fc66b874d class="flex justify-between"><a href=/docs/programmer/langs/>编程语言</a></label><ul><li><input type=checkbox id=section-771df6c720301e69f1715f7fc174ac3d class=toggle>
<label for=section-771df6c720301e69f1715f7fc174ac3d class="flex justify-between"><a role=button>Python</a></label><ul><li><a href=/docs/programmer/langs/python/sqlalchemy/>SqlAlchemy - 数据库Orm</a></li><li><a href=/docs/programmer/langs/python/pypi/>PyPi使用说明</a></li><li><a href=/docs/programmer/langs/python/pytest/>PyTest</a></li><li><a href=/docs/programmer/langs/python/paramiko-%E4%BD%BF%E7%94%A8-sshsftp/>Paramiko 使用 Ssh&amp;sftp</a></li><li><a href=/docs/programmer/langs/python/%E5%A4%9A%E7%BA%BF%E7%A8%8B%E5%A4%9A%E8%BF%9B%E7%A8%8B/>Python 多线程多进程</a></li><li><a href=/docs/programmer/langs/python/notespython/>Python 常用库</a></li><li><a href=/docs/programmer/langs/python/notespython/>Python 笔记</a></li><li><a href=/docs/programmer/langs/python/py%E5%B0%8F%E5%B7%A5%E5%85%B7%E5%92%8C%E5%8A%9F%E8%83%BD%E6%80%A7%E6%96%B9%E6%B3%95/>Py小工具和功能性方法</a></li><li><a href=/docs/programmer/langs/python/notespython/>解决问题</a></li></ul></li><li><input type=checkbox id=section-9f8ac8f06e138c7ac13ff61f23b4d497 class=toggle>
<label for=section-9f8ac8f06e138c7ac13ff61f23b4d497 class="flex justify-between"><a role=button>Golang</a></label><ul><li><a href=/docs/programmer/langs/golang/advanced-knowledge-of-golang/>Golang进阶笔记</a></li><li><a href=/docs/programmer/langs/golang/noteofgoexp/>Golang进阶笔记</a></li><li><a href=/docs/programmer/langs/golang/note-of-golang/>Golang笔记</a></li><li><a href=/docs/programmer/langs/golang/noteofgolang/>Golang笔记</a></li></ul></li><li><a href=/docs/programmer/langs/cmake/>CMake 使用Tips</a></li><li><a href=/docs/programmer/langs/tips-of-debugers/>Tips of debuggers</a></li><li><a href=/docs/programmer/langs/tips-of-markdown/>Tips of MarkDown</a></li><li><a href=/docs/programmer/langs/java/notesjava/>愉快的Java(happy to learn the fuck java)</a></li><li><a href=/docs/programmer/langs/note-for-fmtdata/>数据格式笔记</a></li></ul></li><li><input type=checkbox id=section-de7bfad1d124522974cdf8addfbb23f2 class=toggle>
<label for=section-de7bfad1d124522974cdf8addfbb23f2 class="flex justify-between"><a role=button>Net</a></label><ul><li><a href=/docs/programmer/net/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/>网络编程</a></li><li><a href=/docs/programmer/net/nginx%E5%AE%9E%E7%94%A8%E9%85%8D%E7%BD%AE/>Nginx实用配置</a></li><li><a href=/docs/programmer/net/tips-of-grpc/>gRpc使用小记</a></li><li><a href=/docs/programmer/net/epoll%E5%AE%9E%E7%8E%B0/>Epoll实现</a></li><li><a href=/docs/programmer/net/net/>Epoll实现</a></li></ul></li><li><input type=checkbox id=section-4446dd07527142b855f26d7cc8f0e617 class=toggle>
<label for=section-4446dd07527142b855f26d7cc8f0e617 class="flex justify-between"><a href=/docs/programmer/database/>Database</a></label><ul><li><a href=/docs/programmer/database/mongodb/>Mongodb使用记录</a></li><li><a href=/docs/programmer/database/dgraph/>Dgraph使用小记</a></li><li><a href=/docs/programmer/database/note-of-db-data-mongodb/>数据库-MongoDB篇</a></li><li><a href=/docs/programmer/database/note-of-db-data/>数据库-MongoDB篇</a></li><li><a href=/docs/programmer/database/note-of-db-data-mysql/>数据库-MySQL篇</a></li></ul></li><li><input type=checkbox id=section-7e5360c5e7954906b897ed79085884b6 class=toggle>
<label for=section-7e5360c5e7954906b897ed79085884b6 class="flex justify-between"><a href=/docs/programmer/gui/>图形用户界面-GUI</a></label><ul><li><a href=/docs/programmer/gui/pyinstaller-python%E6%89%93%E5%8C%85/>python打包</a></li><li><a href=/docs/programmer/gui/pyinstaller/>python打包</a></li><li><a href=/docs/programmer/gui/qt/>Qt/PySide</a></li><li><a href=/docs/programmer/gui/noteofvn_py/>Vn.Py学习笔记（Python交易平台框架）</a></li><li><a href=/docs/programmer/gui/vn.py%E7%AC%94%E8%AE%B0-%E4%BA%A4%E6%98%93%E5%B9%B3%E5%8F%B0%E5%AE%A2%E6%88%B7%E7%AB%AF/>Vn.Py学习笔记（Python交易平台框架）</a></li><li><a href=/docs/programmer/gui/notespython/>图形化界面 （Python Gui）</a></li><li><a href=/docs/programmer/gui/notespython/>图形化界面 （Python Gui）</a></li></ul></li><li><input type=checkbox id=section-ddcbe632dc99a9fb372422dada8ee641 class=toggle>
<label for=section-ddcbe632dc99a9fb372422dada8ee641 class="flex justify-between"><a role=button>OS操作系统问题处理</a></label><ul><li><a href=/docs/programmer/os/install_some/>安装问题</a></li><li><a href=/docs/programmer/os/android/>安卓</a></li><li><a href=/docs/programmer/os/freebsd/>FreeBSD</a></li><li><a href=/docs/programmer/os/note-of-linux/>Linux 笔记</a></li><li><a href=/docs/programmer/os/npm/>Npm</a></li><li><a href=/docs/programmer/os/git/>Git</a></li><li><a href=/docs/programmer/os/problem-of-windows/>Windows 爬坑记</a></li><li><a href=/docs/programmer/os/tips-of-problems/>解决问题记录笔记</a></li></ul></li><li><input type=checkbox id=section-d325c59fc6513e1b1e05a60b192d4973 class=toggle>
<label for=section-d325c59fc6513e1b1e05a60b192d4973 class="flex justify-between"><a href=/docs/programmer/hardware/>硬件</a></label><ul><li><a href=/docs/programmer/hardware/raspberrypi/>Raspberry Pi</a></li><li><a href=/docs/programmer/hardware/screen/>Screen</a></li></ul></li></ul></li><li class=book-section-flat><span>建模和游戏</span><ul><li><a href=/docs/3dgame/blender/>Blender</a></li><li><a href=/docs/3dgame/noteofue4/>UE4 笔记</a></li></ul></li><li class=book-section-flat><a href=/docs/example/>Hugo特殊Markdown语法说明</a><ul><li><a href=/docs/example/table-of-contents/>Table of Contents</a><ul><li><a href=/docs/example/table-of-contents/with-toc/>With ToC</a></li><li><a href=/docs/example/table-of-contents/without-toc/>Without ToC</a></li></ul></li><li><a href=/docs/example/shortcodes/buttons/>Buttons</a></li><li><a href=/docs/example/shortcodes/columns/>Columns</a></li><li><a href=/docs/example/shortcodes/details/>Details</a></li><li><a href=/docs/example/shortcodes/expand/>Expand</a></li><li><a href=/docs/example/shortcodes/hints/>Hints</a></li><li><a href=/docs/example/shortcodes/tabs/>Tabs</a></li></ul></li></ul><ul><li><a href=/posts/>Blog</a></li></ul></nav><script>(function(){var e=document.querySelector("aside .book-menu-content");addEventListener("beforeunload",function(){localStorage.setItem("menu.scrollTop",e.scrollTop)}),e.scrollTop=localStorage.getItem("menu.scrollTop")})()</script></div></aside><div class=book-page><header class=book-header><div class="flex align-center justify-between"><label for=menu-control><img src=/svg/menu.svg class=book-icon alt=Menu>
</label><strong>小命令</strong>
<label for=toc-control><img src=/svg/toc.svg class=book-icon alt="Table of Contents"></label></div><aside class="hidden clearfix"><nav id=TableOfContents><ul><li><a href=#1递归删除某些文件>1. 递归删除某些文件</a></li><li><a href=#2批量杀死进程>2. 批量杀死进程</a><ul><li><a href=#批量删除pod---xargs-的使用>批量删除pod - xargs 的使用</a></li></ul></li><li><a href=#3mysqlnow>3. MySQL NOW</a></li><li><a href=#4celeryworker状态>4. celery worker状态</a></li><li><a href=#5base64解码>5. base64解码</a></li><li><a href=#6k8s复制文件>6. k8s 复制文件</a></li><li><a href=#7-查看k8s-dns解析>7. 查看k8s DNS解析</a></li><li><a href=#8-关闭wsl2>8. 关闭WSL2</a></li><li><a href=#9-nginx-代理-mongodb>9. nginx 代理 mongodb</a></li><li><a href=#10-mysql删除锁修改表>10. MySQL删除锁修改表</a></li><li><a href=#11-rz-sz-上传下载服务器小文件>11. rz sz 上传下载服务器小文件</a></li><li><a href=#12-并行下发命令>12. 并行下发命令</a><ul><li><a href=#13-ffmpeg-提取视频中音频>13. ffmpeg 提取视频中音频</a></li><li><a href=#14-windows-休眠>14. Windows 休眠</a></li><li><a href=#15-windows刷新dns缓存---修改hosts之后不生效使用>15. Windows刷新DNS缓存 - 修改hosts之后不生效使用</a></li><li><a href=#16-解压当前目录所有压缩文件>16. 解压当前目录所有压缩文件</a></li><li><a href=#17-通过ip获取主机名>17. 通过IP获取主机名</a></li><li><a href=#18-awk算数>18. awk算数</a></li><li><a href=#19-使用git-commit信息来命名>19. 使用git commit信息来命名</a></li><li><a href=#20-查看设备温度>20. 查看设备温度</a></li><li><a href=#21-压缩视频>21. 压缩视频</a></li><li><a href=#22-连接命令>22. 连接命令</a></li><li><a href=#查看文件占用>查看文件占用</a></li><li><a href=#23-查看文件大小及排序>23. 查看文件大小及排序</a></li></ul></li></ul></nav></aside></header><article class=markdown><h1><a href=/posts/%E5%B0%8F%E5%91%BD%E4%BB%A4/>小命令</a></h1><h5>September 24, 2023</h5><div><a href=/categories/%E5%B0%8F%E5%91%BD%E4%BB%A4/>小命令</a></div><div><a href=/tags/%E5%B0%8F%E5%91%BD%E4%BB%A4/>小命令</a></div><p>前传: [[Make things easy and enjoyable]]</p><h2 id=1递归删除某些文件>1. 递归删除某些文件
<a class=anchor href=#1%e9%80%92%e5%bd%92%e5%88%a0%e9%99%a4%e6%9f%90%e4%ba%9b%e6%96%87%e4%bb%b6>#</a></h2><p>如以.<code>py.bak</code> 为结尾的文件: <code>find . -name "*.py.bak" -exec rm {} \;</code></p><h2 id=2批量杀死进程>2. 批量杀死进程
<a class=anchor href=#2%e6%89%b9%e9%87%8f%e6%9d%80%e6%ad%bb%e8%bf%9b%e7%a8%8b>#</a></h2><p>- pkill -f uwsgi<br>- ps aux | grep 关键字 | awk &lsquo;{print $2}&rsquo; | xargs kill</p><h3 id=批量删除pod---xargs-的使用>批量删除pod - xargs 的使用
<a class=anchor href=#%e6%89%b9%e9%87%8f%e5%88%a0%e9%99%a4pod---xargs-%e7%9a%84%e4%bd%bf%e7%94%a8>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>kubectl get pod -n argo | grep workflow-template | awk <span style=color:#e6db74>&#39;{print $1}&#39;</span> | xargs kubectl -n argo delete pod
</span></span></code></pre></div><h2 id=3mysqlnow>3. MySQL NOW
<a class=anchor href=#3mysqlnow>#</a></h2><p>指定东八：<code>update scanner_device set update_time = CONVERT_TZ(NOW(), @@session.time_zone, "+08:00");</code></p><h2 id=4celeryworker状态>4. celery worker状态
<a class=anchor href=#4celeryworker%e7%8a%b6%e6%80%81>#</a></h2><p><code>celery -A ncelery status</code></p><blockquote><p> ->  celery@scan-celery.rcmrestat.00: OK<br>->  celery@scan-celery.vulcombine.00: OK<br>->  celery@scan-celery.rcmstat.00: OK</p></blockquote><h2 id=5base64解码>5. base64解码
<a class=anchor href=#5base64%e8%a7%a3%e7%a0%81>#</a></h2><p><code>echo YWRtaW46bnNmMGN1cy5Aazhz | base64 -d</code>
使用场景: 如在USER/.docker/config寻找到docker登陆凭证可以用此解码后<code>login</code>登录</p><h2 id=6k8s复制文件>6. k8s 复制文件
<a class=anchor href=#6k8s%e5%a4%8d%e5%88%b6%e6%96%87%e4%bb%b6>#</a></h2><p>kubectl cp -n websafe -c master-fizz-daemon master-fizz-daemon-66c89f7c9c-nlgd4:rcm_vul_info.json rcm_vul_info.json</p><h2 id=7-查看k8s-dns解析>7. 查看k8s DNS解析
<a class=anchor href=#7-%e6%9f%a5%e7%9c%8bk8s-dns%e8%a7%a3%e6%9e%90>#</a></h2><p>kubectl get configmap -n kube-system coredns -o yaml</p><h2 id=8-关闭wsl2>8. 关闭WSL2
<a class=anchor href=#8-%e5%85%b3%e9%97%adwsl2>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-powershell data-lang=powershell><span style=display:flex><span><span style=color:#75715e>#停止LxssManager服务:</span>
</span></span><span style=display:flex><span>net stop LxssManager
</span></span><span style=display:flex><span><span style=color:#75715e>#启动LxssManager服务:</span>
</span></span><span style=display:flex><span>net start LxssManager
</span></span></code></pre></div><h2 id=9-nginx-代理-mongodb>9. nginx 代理 mongodb
<a class=anchor href=#9-nginx-%e4%bb%a3%e7%90%86-mongodb>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-Dockerfile data-lang=Dockerfile><span style=display:flex><span><span style=color:#66d9ef>FROM</span><span style=color:#e6db74> nginx</span><span style=color:#960050;background-color:#1e0010>
</span></span></span><span style=display:flex><span><span style=color:#960050;background-color:#1e0010>
</span></span></span><span style=display:flex><span><span style=color:#960050;background-color:#1e0010></span><span style=color:#66d9ef>RUN</span> echo <span style=color:#e6db74>&#34;stream {\n    upstream stream_mongo {\n        server mongo:27017;\n    }\n\n    server {\n        listen 9876;\n        proxy_pass stream_mongo;\n    }\n}&#34;</span> &gt;&gt; /etc/nginx/nginx.conf<span style=color:#960050;background-color:#1e0010>
</span></span></span></code></pre></div><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>docker build -t nginx-proxy:v0 .
</span></span><span style=display:flex><span>docker run -p 12345:9876 --network websafe-network --name nginx-proxy nginx-proxy:v0
</span></span><span style=display:flex><span><span style=color:#75715e># 连接 12345 即可</span>
</span></span></code></pre></div><h2 id=10-mysql删除锁修改表>10. MySQL删除锁修改表
<a class=anchor href=#10-mysql%e5%88%a0%e9%99%a4%e9%94%81%e4%bf%ae%e6%94%b9%e8%a1%a8>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-sql data-lang=sql><span style=display:flex><span><span style=color:#66d9ef>SHOW</span> PROCESSLIST;
</span></span><span style=display:flex><span>KILL <span style=color:#ae81ff>6261330</span>;
</span></span><span style=display:flex><span><span style=color:#75715e>-- 根据表所在的库名找见ID，然后删除锁
</span></span></span><span style=display:flex><span><span style=color:#75715e></span><span style=color:#66d9ef>LOCK</span> TABLES task <span style=color:#66d9ef>WRITE</span>;
</span></span><span style=display:flex><span><span style=color:#66d9ef>ALTER</span> <span style=color:#66d9ef>TABLE</span> task <span style=color:#66d9ef>ADD</span> <span style=color:#66d9ef>COLUMN</span> module_id INT <span style=color:#66d9ef>not</span> <span style=color:#66d9ef>null</span> <span style=color:#66d9ef>DEFAULT</span> <span style=color:#ae81ff>1005</span> <span style=color:#66d9ef>COMMENT</span> <span style=color:#e6db74>&#39;这里是SQL字段注释&#39;</span>;
</span></span><span style=display:flex><span>UNLOCK TABLES;
</span></span></code></pre></div><h2 id=11-rz-sz-上传下载服务器小文件>11. rz sz 上传下载服务器小文件
<a class=anchor href=#11-rz-sz-%e4%b8%8a%e4%bc%a0%e4%b8%8b%e8%bd%bd%e6%9c%8d%e5%8a%a1%e5%99%a8%e5%b0%8f%e6%96%87%e4%bb%b6>#</a></h2><ul><li>安装命令: <code>apt install lrzsz</code></li><li>下载 <code>sz xxx</code></li><li>上传 <code>rz</code></li></ul><h2 id=12-并行下发命令>12. 并行下发命令
<a class=anchor href=#12-%e5%b9%b6%e8%a1%8c%e4%b8%8b%e5%8f%91%e5%91%bd%e4%bb%a4>#</a></h2><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>time parallel -N0 -j10 <span style=color:#e6db74>&#34;argo submit success.yaml -n argo&#34;</span> ::: <span style=color:#f92672>{</span>1..100<span style=color:#f92672>}</span>
</span></span></code></pre></div><p>使用 <code>-N</code> 限制每行参数的个数，其中<code>-N0</code>表示一次只读取一个参数，且不输入这个参数（作为计数器来使用）。</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>parallel -N4 echo 1<span style=color:#f92672>={</span>1<span style=color:#f92672>}</span> 2<span style=color:#f92672>={</span>2<span style=color:#f92672>}</span> 3<span style=color:#f92672>={</span>3<span style=color:#f92672>}</span> ::: A B C D E F G H
</span></span><span style=display:flex><span>1<span style=color:#f92672>=</span>A 2<span style=color:#f92672>=</span>B 3<span style=color:#f92672>=</span>C // D传入了，但没接收所以下一行丢失
</span></span><span style=display:flex><span>1<span style=color:#f92672>=</span>E 2<span style=color:#f92672>=</span>F 3<span style=color:#f92672>=</span>G
</span></span><span style=display:flex><span>parallel -N0 echo foo ::: <span style=color:#ae81ff>1</span> <span style=color:#ae81ff>2</span> <span style=color:#ae81ff>3</span>
</span></span><span style=display:flex><span>foo
</span></span><span style=display:flex><span>foo
</span></span><span style=display:flex><span>foo
</span></span></code></pre></div><p>如果要打印计数，可以使用<code>time parallel -N1 -j10 "echo '[$(date)] 第 {}：次提交中...' & ls" ::: {1..10}</code>或者不指定<code>N1</code>默认就是<code>N1</code></p><h3 id=13-ffmpeg-提取视频中音频>13. ffmpeg 提取视频中音频
<a class=anchor href=#13-ffmpeg-%e6%8f%90%e5%8f%96%e8%a7%86%e9%a2%91%e4%b8%ad%e9%9f%b3%e9%a2%91>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>ffmpeg -i englishdemo.mp4 -vn -c:a copy english.aac
</span></span></code></pre></div><h4 id=提取并转换为mp3格式>提取并转换为mp3格式
<a class=anchor href=#%e6%8f%90%e5%8f%96%e5%b9%b6%e8%bd%ac%e6%8d%a2%e4%b8%bamp3%e6%a0%bc%e5%bc%8f>#</a></h4><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>ffmpeg -i englishdemo.mp4 -vn -b:a 128k -c:a mp3 english.mp3
</span></span></code></pre></div><h3 id=14-windows-休眠>14. Windows 休眠
<a class=anchor href=#14-windows-%e4%bc%91%e7%9c%a0>#</a></h3><blockquote><p>cmd 管理员模式运行</p></blockquote><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-cmd data-lang=cmd><span style=display:flex><span>powercfg.exe -h off
</span></span><span style=display:flex><span>powercfg.exe -h on
</span></span></code></pre></div><h3 id=15-windows刷新dns缓存---修改hosts之后不生效使用>15. Windows刷新DNS缓存 - 修改hosts之后不生效使用
<a class=anchor href=#15-windows%e5%88%b7%e6%96%b0dns%e7%bc%93%e5%ad%98---%e4%bf%ae%e6%94%b9hosts%e4%b9%8b%e5%90%8e%e4%b8%8d%e7%94%9f%e6%95%88%e4%bd%bf%e7%94%a8>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-Powershell data-lang=Powershell><span style=display:flex><span>ipconfig /flushdns
</span></span></code></pre></div><h3 id=16-解压当前目录所有压缩文件>16. 解压当前目录所有压缩文件
<a class=anchor href=#16-%e8%a7%a3%e5%8e%8b%e5%bd%93%e5%89%8d%e7%9b%ae%e5%bd%95%e6%89%80%e6%9c%89%e5%8e%8b%e7%bc%a9%e6%96%87%e4%bb%b6>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#66d9ef>for</span> f in *.zip; <span style=color:#66d9ef>do</span> unzip <span style=color:#e6db74>&#34;</span>$f<span style=color:#e6db74>&#34;</span>; <span style=color:#66d9ef>done</span>
</span></span></code></pre></div><h3 id=17-通过ip获取主机名>17. 通过IP获取主机名
<a class=anchor href=#17-%e9%80%9a%e8%bf%87ip%e8%8e%b7%e5%8f%96%e4%b8%bb%e6%9c%ba%e5%90%8d>#</a></h3><blockquote><p>不过看情况，如果没有启动NetBIOS就查不到</p></blockquote><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#75715e># 基於TCP/IP上的NetBIOS客戶用於查詢NetBIOS名字的程序</span>
</span></span><span style=display:flex><span>nmblookup -A <span style=color:#f92672>{</span>IP<span style=color:#f92672>}</span>
</span></span></code></pre></div><h3 id=18-awk算数>18. awk算数
<a class=anchor href=#18-awk%e7%ae%97%e6%95%b0>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>grep <span style=color:#ae81ff>400586</span> sched.log.2024-05-28 | grep 条 | awk <span style=color:#e6db74>&#39;{print $8}&#39;</span> | awk -F<span style=color:#e6db74>&#39;条,&#39;</span> <span style=color:#e6db74>&#39;{sum += $1} END {print sum}&#39;</span>
</span></span></code></pre></div><ul><li><code>awk -F'条,' '{sum += $1} END {print sum}'</code> 用<code>条</code>进行分割取<code>$1</code>第一个进行<code>sum</code>求和计算</li><li><code>awk '{print $8}'</code> 这里注意使用<code>单引号</code></li></ul><blockquote><p>250</p></blockquote><p>原日志数据为:</p><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-text data-lang=text><span style=display:flex><span>2024-05-28 18:15:51 sched WARNING [1178]: await self.redis.enqueue_update_db(*update_tasks) 1条, 0 is: 400586 + 2024-05-28 05:24:52 + MY
</span></span><span style=display:flex><span>2024-05-28 18:49:20 sched WARNING [1178]: await self.redis.enqueue_update_db(*update_tasks) 3条, 0 is: 400586 + 2024-05-28 03:02:38 + MY
</span></span><span style=display:flex><span>2024-05-28 18:59:50 sched WARNING [1178]: await self.redis.enqueue_update_db(*update_tasks) 4条, 0 is: 400586 + 2024-05-28 04:12:04 + MY
</span></span></code></pre></div><h3 id=19-使用git-commit信息来命名>19. 使用git commit信息来命名
<a class=anchor href=#19-%e4%bd%bf%e7%94%a8git-commit%e4%bf%a1%e6%81%af%e6%9d%a5%e5%91%bd%e5%90%8d>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span><span style=color:#75715e># 时间</span>
</span></span><span style=display:flex><span>echo <span style=color:#e6db74>&#34;{name}-</span><span style=color:#66d9ef>$(</span>git log -1 --format<span style=color:#f92672>=</span>%cd --date<span style=color:#f92672>=</span>format:<span style=color:#e6db74>&#39;%Y%m%d-%H%M%S&#39;</span><span style=color:#66d9ef>)</span><span style=color:#e6db74>.tar.gz&#34;</span>
</span></span><span style=display:flex><span><span style=color:#75715e># commit_id+时间</span>
</span></span><span style=display:flex><span>echo <span style=color:#e6db74>&#34;name-</span><span style=color:#66d9ef>$(</span>git log -1 --format<span style=color:#f92672>=</span>%h<span style=color:#66d9ef>)</span><span style=color:#e6db74>-</span><span style=color:#66d9ef>$(</span>date +<span style=color:#e6db74>&#39;%Y%m%d-%H%M%S&#39;</span><span style=color:#66d9ef>)</span><span style=color:#e6db74>.tar.gz&#34;</span>
</span></span></code></pre></div><h3 id=20-查看设备温度>20. 查看设备温度
<a class=anchor href=#20-%e6%9f%a5%e7%9c%8b%e8%ae%be%e5%a4%87%e6%b8%a9%e5%ba%a6>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>sudo apt install lm-sensors
</span></span><span style=display:flex><span>sensors
</span></span></code></pre></div><h3 id=21-压缩视频>21. 压缩视频
<a class=anchor href=#21-%e5%8e%8b%e7%bc%a9%e8%a7%86%e9%a2%91>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>ffmpeg -i 原视频.mp4 -c:v libx264 -b:v 2000k -c:a aac -b:a 128k -pix_fmt yuv420p -movflags faststart 输出视频.mp4
</span></span></code></pre></div><h3 id=22-连接命令>22. 连接命令
<a class=anchor href=#22-%e8%bf%9e%e6%8e%a5%e5%91%bd%e4%bb%a4>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>sl <span style=color:#f92672>&amp;&amp;</span> ls 
</span></span><span style=display:flex><span>sl; ls
</span></span></code></pre></div><p>1中<code>sl</code>失败后不会执行后续的<code>ls</code>, 2中<code>sl</code>失败后也会执行<code>ls</code></p><h3 id=查看文件占用>查看文件占用
<a class=anchor href=#%e6%9f%a5%e7%9c%8b%e6%96%87%e4%bb%b6%e5%8d%a0%e7%94%a8>#</a></h3><p><code>fuser -v {file path}</code></p><h3 id=23-查看文件大小及排序>23. 查看文件大小及排序
<a class=anchor href=#23-%e6%9f%a5%e7%9c%8b%e6%96%87%e4%bb%b6%e5%a4%a7%e5%b0%8f%e5%8f%8a%e6%8e%92%e5%ba%8f>#</a></h3><div class=highlight><pre tabindex=0 style=color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4><code class=language-bash data-lang=bash><span style=display:flex><span>du -sh ~/go/pkg/mod/github.com/* | sort -rh | head
</span></span></code></pre></div></article><footer class=book-footer><div class="flex flex-wrap justify-between"></div><script>(function(){function e(e){const t=window.getSelection(),n=document.createRange();n.selectNodeContents(e),t.removeAllRanges(),t.addRange(n)}document.querySelectorAll("pre code").forEach(t=>{t.addEventListener("click",function(){if(window.getSelection().toString())return;e(t.parentElement),navigator.clipboard&&navigator.clipboard.writeText(t.parentElement.textContent)})})})()</script></footer><div class=book-comments></div><label for=menu-control class="hidden book-menu-overlay"></label></div><aside class=book-toc><div class=book-toc-content><nav id=TableOfContents><ul><li><a href=#1递归删除某些文件>1. 递归删除某些文件</a></li><li><a href=#2批量杀死进程>2. 批量杀死进程</a><ul><li><a href=#批量删除pod---xargs-的使用>批量删除pod - xargs 的使用</a></li></ul></li><li><a href=#3mysqlnow>3. MySQL NOW</a></li><li><a href=#4celeryworker状态>4. celery worker状态</a></li><li><a href=#5base64解码>5. base64解码</a></li><li><a href=#6k8s复制文件>6. k8s 复制文件</a></li><li><a href=#7-查看k8s-dns解析>7. 查看k8s DNS解析</a></li><li><a href=#8-关闭wsl2>8. 关闭WSL2</a></li><li><a href=#9-nginx-代理-mongodb>9. nginx 代理 mongodb</a></li><li><a href=#10-mysql删除锁修改表>10. MySQL删除锁修改表</a></li><li><a href=#11-rz-sz-上传下载服务器小文件>11. rz sz 上传下载服务器小文件</a></li><li><a href=#12-并行下发命令>12. 并行下发命令</a><ul><li><a href=#13-ffmpeg-提取视频中音频>13. ffmpeg 提取视频中音频</a></li><li><a href=#14-windows-休眠>14. Windows 休眠</a></li><li><a href=#15-windows刷新dns缓存---修改hosts之后不生效使用>15. Windows刷新DNS缓存 - 修改hosts之后不生效使用</a></li><li><a href=#16-解压当前目录所有压缩文件>16. 解压当前目录所有压缩文件</a></li><li><a href=#17-通过ip获取主机名>17. 通过IP获取主机名</a></li><li><a href=#18-awk算数>18. awk算数</a></li><li><a href=#19-使用git-commit信息来命名>19. 使用git commit信息来命名</a></li><li><a href=#20-查看设备温度>20. 查看设备温度</a></li><li><a href=#21-压缩视频>21. 压缩视频</a></li><li><a href=#22-连接命令>22. 连接命令</a></li><li><a href=#查看文件占用>查看文件占用</a></li><li><a href=#23-查看文件大小及排序>23. 查看文件大小及排序</a></li></ul></li></ul></nav></div></aside></main></body></html>